﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DesignPattern
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FactoryPattern.FormOperation formOpr = new FactoryPattern.FormOperation();
            formOpr.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            StrategyPattern.FormStrategy formStg = new StrategyPattern.FormStrategy();
            formStg.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            DecoratePattern.Person person = new DecoratePattern.Person("小张");
            DecoratePattern.BigTrousers bigTrou = new DecoratePattern.BigTrousers();
            DecoratePattern.TShirt tShirt = new DecoratePattern.TShirt();

            bigTrou.Decorate(person);
            tShirt.Decorate(bigTrou);
            tShirt.Show();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            ProxyPattern.Proxy proxy = new ProxyPattern.Proxy("MM");
            proxy.Request();
        }
    }
}
